class_name GameplayObject
extends CharacterBody2D

var face_direction: int = 1

@onready var animator: AnimatedSprite2D = %Animator

@onready var asc: AbilitySystemComponent = %AbilitySystemComponent

@onready var state_machine: GameplayStateMachine = %StateMachine


func flip() -> void:
	face_direction = -face_direction
	scale.x = -scale.x


#region Helper Functions
#region Animator
func play_animation(animation_name: String) -> void:
	animator.play(animation_name)


func stop_animation() -> void:
	animator.stop()
#endregion


#region Gameplay Attribute 
func get_attribute(attribute_name: String) -> GameplayAttribute:
	return asc.attribute_set.get_attribute(attribute_name)
#endregion


#region Gameplay Tag
func add_tag(tag: String) -> void:
	asc.tag_manager.add_tag(tag)


func add_tags(tags: Array[String]) -> void:
	asc.tag_manager.add_tags(tags)


func remove_tag(tag: String) -> void:
	asc.tag_manager.remove_tag(tag)


func remove_tags(tags: Array[String]) -> void:
	asc.tag_manager.remove_tags(tags)


func has_tag(tag: String) -> bool:
	return asc.tag_manager.has_tag(tag)


func has_any_tags(tags: Array[String]) -> bool:
	return asc.tag_manager.has_any_tags(tags)


func has_all_tags(tags: Array[String]) -> bool:
	return asc.tag_manager.has_all_tags(tags)


func get_all_tags() -> Array[String]:
	return asc.tag_manager.get_all_tags()
#endregion


#region Gameplay Ability
func activate_ability(ability_name: String, target: AbilitySystemComponent) -> void:
	asc.ability_manager.activate_ability(ability_name, target)
#endregion
#endregion
